#include "StdAfx.h"
#include "SubStructure.h"
#include "Effect.h"
#include "Mediator.h"
#include "Bomb2.h"

Bomb2::Bomb2()
{
	nowPos.x = 0.0f;
	nowPos.y = 0.0f;
}

Bomb2::~Bomb2()
{
}

void Bomb2::Update()
{
	BombViewCount++;
	nowAniCount++;

	if(BombViewCount > 19)
	{
		if((BombViewCount - 20) % 5 == 0)
		{
			EventList tL;
			Event_struct* tE;
			for(int i = 0; i < 2; ++i)
			{
				tE = new Event_struct();
				tE->ID = 43;
				tE->flag = 1;
				tE->kind = 0;
				tE->makePos.x = 192.0f + (((i + 1) * 2) - 3) * ((BombViewCount - 20) / 5 + 1) * 40.0f;
				tE->makePos.y = 120.0f;
				tL.push_back(tE);
			}
			process->GetEvent(tL);
		}
	}

	if(nowAniCount >= nowAni.this_cut_count)
	{
		if(nowAniState2 >= (_Ani[nowAniState1].size() - 1))
		{
			nowAniState1 = nowAni.next_ani;
			nowAniState2 = 0;
			nowAni = *_Ani[nowAniState1][nowAniState2];
		}
		else
		{
			++nowAniState2;
			nowAni = *_Ani[nowAniState1][nowAniState2];
		}
		nowAniCount = 0;
	}
}

void Bomb2::Draw()
{
	GameBase::pSprite->Draw(nowAni.Texture,
							&nowAni.Source,
							NULL,
							NULL,
							nowAni.invisible);
}

void Bomb2::Reset()
{
	NowState = NONLIVE;
	BombViewCount = 0;
	nowAniState1 = 0;
	nowAniState2 = 0;
	nowAniCount = 0;
}